1. Field of the Invention
This invention relates in general to computer-implemented database systems, and, in particular, to deferring large object access with intermediate results.
2. Description of Related Art
Databases are computerized information storage and retrieval systems. A Relational Database Management System (RDBMS) is a database management system (DBMS) which uses relational techniques for storing and retrieving data. Relational databases are organized into tables which consist of rows and columns of data. The rows are formally called tuples or records. A database will typically have many tables and each table will typically have multiple tuples and multiple columns. Tables are assigned to table spaces. A table space is associated with direct access storage devices (DASD), and, thus, tables, are stored on DASD, such as magnetic or optical disk drives for semi-permanent storage.
A table space can be a system managed space (e.g., an operating system file system) or a database managed space. Each table space is physically divided into equal units called pages. Each page, which typically contains 4K bytes, holds one or more rows of a table and is the unit of input/output (I/O). The rows of a table are physically stored as records on a page. A record is always fully contained within a page and is limited by page size. As users move towards working with image data and other large data objects, storing data in conventional records becomes difficult.
An index is an ordered set of references to the records or rows in a database file or table. The index is used to access each record in the file using a key (i.e., one of the fields of the record or attributes of the row). However, building an index for a large file can take a considerable amount of elapsed time. The process involves scanning all records in the file, extracting a key value and record identifier (rid) value from each of the records, sorting all of the key/rid values, and then building the index from the sorted key/rid values. Typically, the scanning, sorting, and index build steps are performed serially, which can be time consuming in the case of a large database file.
Traditionally, an RDBMS stored simple data, such as numeric and text data. In a traditional RDBMS, the underlying storage management has been optimized for simple data. More specifically, the size of a record is limited by the size of a data page, which is a fixed number (e.g., 4K) defined by a computer developer. This restriction in turn poses a limitation on the length of columns of a table. To alleviate such a restriction, most computer developers today support a new built-in data type for storing large objects (LOBs). Large objects, such as image data, typically take up a great deal of storage space.
An RDBMS often generates intermediate result sets in the process of satisfying a query. Each row of these intermediate result sets contain the data from all necessary columns. For example, if a table included five columns, with two columns containing large object data, the RDBMS would generate a row with all five columns. However, for performance and storage reasons, it is desirable to access large objects as infrequently as possible. Thus, it is desirable to avoid placing the large object data into the intermediate result sets.
Therefore, there is a need in the art for an improved technique of deferring large object access with intermediate results.
To overcome the limitations in the prior art described above, and to overcome other limitations that will become apparent upon reading and understanding the present specification, the present invention discloses a method, apparatus, and article of manufacture for a computer implemented technique of deferring large object access with intermediate results.
In accordance with the present invention, a query is executed in a database stored on a data storage device connected to a computer. A control structure representing an expression in the query is generated. An intermediate result is generated by retrieving data for the query that is not represented by the control structure. Then, a result table is built using the processed intermediate result and the control structure.